class Gun:
    def __init__(self, model):
        self.model = model
        self.bullet_count = 0

    def __str__(self):
        print("")

    def add_bullet(self, count):
        self.bullet_count += count

    def shoot(self):
        if (self.bullet_count > 0):
            self.bullet_count -= 1
            print("[{0}]突突突，子弹剩余{1}".format(self.model, self.bullet_count))
        else:
            print("[{0}]没有子弹了，请换子弹！".format(self.model))
            return


class Soldiier:
    def __init__(self, name):
        self.name = name
        #新兵没有枪
        self.gun = None

    def fire(self):
        if (self.gun is None):
            print("没有枪，不能开火!")
            return -1
        if self.gun.bullet_count == 0:
            print("枪没有子弹，不能开火!")
            return -2
        self.gun.shoot()
        return self.gun.bullet_count

    def add_bullet(self, count):
        self.gun.add_bullet(count)


ak = Gun("ak47")
xusanduo = Soldiier("许三多")
xusanduo.gun = ak
ak.add_bullet(50)
while (xusanduo.fire() > 0):
    xusanduo.fire()